import React from 'react'

import {WeaLocaleProvider} from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;

import './style'
import ContainerModle from '../../common/containerModle'
import AddExtend from './addExtend'
import SettingExtend from './settingExtend'
import SettingProxy from './settingProxy'
import ContainerViewExtend from './containerViewExtend'
import ContainerViewProxy from './containerViewProxy'


export default class CompanyNews extends React.Component{

    static defaultProps = {
        javaInterface:{
            find: '/api/portalTsLogin/element/getCompanyNewsPerfectData',
            save: '/api/portalTs/customCompanyNewsPerfect/save',
            update: '/api/portalTs/customCompanyNewsPerfect/update',
            saveOrUpdateItem: '/api/portalTs/customCompanyNewsPerfect/saveOrUpdateItem',
            deleteItem: '/api/portalTs/customCompanyNewsPerfect/deleteItem',
            orderItem: '/api/portalTs/customCompanyNewsPerfect/orderItem',
        }
    }

    onSaveBeforeHandler = (setting={})=>{
        setting.title = getLabel(131205, '公司新闻')

    }

    onLoadAfterHandler = (data)=>{
        // for(let i in data.eFieldNewDataSource){
        //     if(data.eFieldNewDataSource.hasOwnProperty(i)){
        //         data.eFieldNewDataSource[i].name = getLabel(data.eFieldNewDataSource[i].name, data.eFieldNewDataSource[i].name)
        //     }
        // }
    }

    render(){

        return (
            <ContainerModle ecId={`${this && this.props && this.props.ecId || ''}_ContainerModle@ugl9ar`} {...this.props} {...(this.props.location ? this.props.location.query :{})} ContainerViewProxy={ContainerViewProxy} SettingProxy={SettingProxy} onSaveBeforeHandler={this.onSaveBeforeHandler} onLoadAfterHandler={this.onLoadAfterHandler} AddExtend={AddExtend} SettingExtend={SettingExtend} ContainerViewExtend={ContainerViewExtend} >
            </ContainerModle>
        )
    }
}